#!/usr/bin/env python
# -*- coding: utf-8 -*-
from ConfigParser import SafeConfigParser

NAV_CMDS = ['nav-up', 'nav-down', 'nav-left', 'nav-right', 'nav-confirm', 'nav-back']
ACT_CMDS = ['aX', 'aY', 'A', 'B', 'C', 'D']

class NoDefaultConfigError(Exception):
    pass

class MoonBunnyConfig(SafeConfigParser):
    def __init__(self, user_file, defaults_file=None):
        SafeConfigParser.__init__(self)
        self.user_file = user_file
        if defaults_file:
            try:
                self.readfp(open(defaults_file))
            except IOError:
                raise NoDefaultConfigError()
        self.read(self.user_file)
            
    def save(self):
        self.write(file(self.user_file, 'w'))
